;+
;PURPOSE 
;	to convert a float to a string in a particular format
;SYNTAX
;	res=flt_2_string(flts, sig_figs)
;INPUTS
;	flts: an array of floats
;	sig_figs: the number of significant digits you want
;
;Written by R. da Silva, UCSC, 7-15-10
;-


FUNCTION flt_2_string, flts, sig_figs=sig_figs
if not keyword_set(sig_figs) then sig_figs=3
log_flts=floor(alog10(flts))
flts1=flts/10.^log_flts

strings=rstring(flts1, format='(f6.'+rstring(long(sig_figs)-1)+')')
strings=strings+'E'+rstring(long(log_flts))
return, strings
end
